<?php

namespace App\Validate;

use App\Validate\BaseValidate;

/**
 *音频资源管理
 */
class ResourceAudioChapterInfoValidate extends  BaseValidate
{
    //验证规则
    protected $rule = [
        'id' => 'bail|required|integer',
        'audio_id' => 'bail|required|integer',
        'chapter_name' => 'bail|required',
        'chapter_id' => 'bail|required|integer',
        'chapter_src' => 'bail|required',
        'size' => 'bail|required|integer',

        'postfix' => 'bail|required',
        'content' => 'bail|required',
    ];

    //自定义验证信息
    protected $message = [
        'id.required' => 'ID不能为空',
        'id.integer' => 'ID格式不正确',
        'chapter_name.required' => '章节名字不能为空',
        'audio_id.required' => '音频ID不能为空',
        'audio_id.integer' => '音频ID格式不正确',
        'chapter_id.required' => '章节ID不能为空',
        'chapter_id.integer' => '章节ID格式不正确',
        'chapter_src.required' => '资源地址不能为空',

        'size.required' => '资源大小不能为空',
        'size.integer' => '资源大小格式不正确',
        'postfix.required' => '资源后缀名大小不能为空',

        'content.required' => '内容不能为空',

    ];


    //自定义场景
    protected $scene = [
        'lists' => ['audio_id'], //详情
        'detail' => ['chapter_id'], //详情
        'add' => ['audio_id', 'chapter_name', 'chapter_src', 'size'], //添加
        'change' => ['chapter_id', 'audio_id', 'chapter_name', 'size', 'chapter_src'], //修改
        'del' => ['chapter_id'], //删除


        'sort_change' => ['content'], //排序

    ];
}
